#ifndef UTILS_H
#define UTILS_H

template <typename T>
class ValueWithPast
{
    T val;
    T prevVal;
public:
    ValueWithPast()
        : val()
        , prevVal()
    {}

    const T& value() const {return val;}
    void setValue(const T& v)
    {
        prevVal = val;
        val = v;
    }

    const T& prevValue() {return prevVal;}
};

#endif // UTILS_H
